<!DOCTYPE html>
<html>
<head lang="en">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <title>修改密码</title>
    <link type="text/css" rel="stylesheet" href="__STATIC__/home/center/css/mall.css"/>
    <link rel="shortcut icon" href="__STATIC__/home/index/picture/2.png" type="image/x-icon">
</head>
<body>
<div id="child_header">
    <div class="goback"><a href="javascript:history.back(-1)"><i></i></a></div>
    <div class="current_location"><span>修改密码</span></div>
    <div class="next_operate"><span onclick="btn()">保存</span></div>
</div>

<div class="password_change">
    <form id="forms" action="" method="post">
    <div class="psd_li">
        <span>原密码</span>
        <input type="password" name="old_password" placeholder="请输入原密码" maxlength="20" value="">
    </div>

    <div class="psd_li">
        <span>新密码</span>
        <input type="password" name="user_pwd" placeholder="请输入4~20位密码" maxlength="20" value="">
    </div>

    <div class="psd_li">
        <span>确认密码</span>
        <input type="password"  name="user_pwd1" placeholder="请再次输入密码" maxlength="20" value="">
    </div>
    </form>
</div>
<script>


    function btn() {
         $.ajax({
             'type':'post',
             'url':"{:url('home/center/password')}",
             'data':$("#forms").serialize(),
             'success':function (data) {
                 console.log(data);
                 if(data==0){
                     layer.msg('修改成功！！', {icon: 1});
                     setTimeout(function(){
                         window.location.href=("{:url('home/users/login')}");
                     },1000);
                 }
                 else if(data==1){
                     layer.msg('原始密码不对！！', {icon: 5});
                 }
                 else if(data==2){
                     layer.msg('两次密码不一致！！', {icon: 5});
                 }else if(data==3){
                     layer.msg('修改失败！！', {icon: 5});
                 }else if(data==4){
                     layer.msg('请填写完整信息！！', {icon: 5});
                 }
             }
         })
    }

</script>
<script src="__STATIC__/home/js/jquery.min.js"></script>
<script src="__STATIC__/home/js/layer/layer.js"></script>
</body>
</html>